#include <bits/stdc++.h>
// 2025/02/02
// tag: 
// Author: Zhang Muen
using namespace std;
const int N = 200001;

int n, m, w[N], v[N], section[N][2];
int64_t preW[N], preV[N], s;

int64_t check(int W){
    memset(preW, 0, sizeof(preW));
    memset(preV, 0, sizeof(preV));
    for (int i = 1; i <= n; i++){
        preW[i] = preW[i - 1], preV[i] = preV[i - 1];
        if (w[i] >= W)
            preW[i]++, preV[i] += v[i];
    }
    int64_t ans = 0;
    for (int i = 1; i <= m; i++){
        int l = section[i][0], r = section[i][1];
        ans += (preW[r] - preW[l - 1]) * (preV[r] - preV[l - 1]);
    }
    return ans;
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> m >> s;
    for (int i = 1; i <= n; i++)
        cin >> w[i] >> v[i];
    for (int i = 1; i <= m; i++)
        cin >> section[i][0] >> section[i][1];
    int l = 0, r = 1e6;
    while (l <= r){
        int W = (l + r) >> 1;
        if (check(W) >= s)
            l = W + 1;
        else
            r = W - 1;
    }
    cout << min(abs(check(r) - s), abs(check(l) - s)) << endl;
    return 0;
}